
import os
import sys

gccbuilder=r"C:/MinGW/bin/gcc.exe"
workpath = os.getcwd()
encappath = os.path.join(workpath,"ENCAP")
globalpath = os.path.join(workpath,"GLOBAL")
modelpath = os.path.join(workpath,"MODEL")
viewpath = os.path.join(workpath,"VIEW")

outpath = os.path.join(workpath,"out")

#source文件夹下的.c，输出.o文件到output文件夹

#output文件夹下的.o，输出.lib文件到library文件夹
#


toliblist = []
#toexelist = []

for i in os.listdir(encappath):
    encapfilename = os.path.join(encappath , i)
for i in os.listdir(globalpath):
    globalfilename = os.path.join(globalpath , i)
for i in os.listdir(modelpath):
    modelfilename = os.path.join(modelpath , i)
for i in os.listdir(viewpath):
    viewfilename = os.path.join(viewpath , i)

ofilename =os.path.join(outpath, os.path.splitext(i)[0]+".o")
print(gccbuilder+" -c "+encapfilename+globalfilename+modelfilename+viewfilename+" -o " +ofilename)
os.system(gccbuilder+" -c "+encapfilename+globalfilename+modelfilename+viewfilename +" -o " +ofilename)
    

